using System;

namespace SqlSugarLearing.M_Dto
{
    /// <summary>
    /// 用户信息
    /// </summary>
    public class UserInfo
    {
        /// <summary>
        /// 用户ID [Operator.id]
        /// </summary>
        public int ID { get; set; }
        /// <summary>
        /// 网校用户ID
        /// </summary>
        public int NSID { get; set; }
        /// <summary>
        /// [Operator.opid]
        /// </summary>
        public string Account { get; set; }
        /// <summary>
        /// [YTStaff.StaffName]  [Operator.opname]
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 网校账户名称
        /// </summary>
        public string NSName { get; set; }
        /// <summary>
        /// 网校账户头像
        /// </summary>
        public string NSAvatar { get; set; }
        /// <summary>
        /// -1:允许下单 -2禁止下单 >0 正常ID
        /// </summary>
        public int PartID { get; set; }
        /// <summary>
        /// [Agent.AName]
        /// </summary>
        public string AgentName { get; set; }
        /// <summary>
        /// [Operator.opcompany]
        /// </summary>
        public int CompanyID { get; set; }
        /// <summary>
        /// [Operator.opemployeeID]
        /// </summary>
        public int EmployeeID { get; set; }
        /// <summary>
        /// [Operator.optype]
        /// </summary>
        public string Type { get; set; }
        /// <summary>
        /// [Agent.AID]
        /// </summary>
        public int AgentID { get; set; }
        /// <summary>
        /// [Agent.Atype]
        /// </summary>
        public string AgentType { get; set; }
        /// <summary>
        /// [Agent.ADeptID]
        /// </summary>
        public int AgengDepartID { get; set; }
        /// <summary>
        /// 用户类型
        /// </summary>
        public UserType UserType { get; set; }
        /// <summary>
        /// 等级
        /// </summary>
        public string AgentLevel { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string AgentPhone { get; set; }
        /// <summary>
        /// 业务员ID
        /// </summary>
        public int AEID { get; set; }
        /// <summary>
        /// token
        /// </summary>
        public string Token { get; set; }
        /// <summary>
        /// ip地址
        /// </summary>
        /// <value></value>
        public string IPAddress { get; set; }
        /// <summary>
        /// obj类型转换
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="nullType"></param>
        /// <returns></returns>
        public string ConvertObj(object obj, string nullType)
        {
            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                if (nullType.ToLower() == "datetime")
                    return DateTime.Now.ToString();
                if (nullType.ToLower() == "bool")
                    return "false";
                if (nullType.ToLower() == "string")
                    return "";

                return "0";
            }
            else
            {
                return obj.ToString();
            }
        }

    }

    /// <summary>
    /// 用户类型枚举
    /// </summary>
    public enum UserType
    {
        /// <summary>
        /// CRM人员[B0006]
        /// </summary>
        crm,
        /// <summary>
        /// 直销/经销商[B0002]
        /// </summary>
        agent,
        /// <summary>
        /// 幼儿园园长[B0001]
        /// </summary>
        kindergarten,
        /// <summary>
        /// 客服/管理员[B0004]
        /// </summary>
        admin,
        /// <summary>
        /// 网校用户
        /// </summary>
        netSchool
    }
}